<!doctype html>
<html>
<head>
    <include file="public/head"/>
    <title>客服系统</title>
    <meta name="description" content="客服系统">
    <meta name="keywords" content="客服系统">
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li class="active"><a>客服系统后台</a></li>
    </ul>
    <div class="wrap">
        <ul class="nav nav-tabs">
            <li class="active"><a href="{:cmf_plugin_url('LyzKefuChat://AdminIndex/index')}">客服系统设置</a></li>
            <li class="active"><a href="{:cmf_plugin_url('LyzKefuChat://AdminIndex/kefuList')}">客服列表</a></li>
            <li class="active"><a href="{:cmf_plugin_url('LyzKefuChat://AdminIndex/kefuAdd')}">客服添加</a></li>
            <li class="active"><a href="{:cmf_plugin_url('LyzKefuChat://AdminIndex/status')}">客服系统服务开启教程</a></li>
        </ul>
        <form method="post" class="form-horizontal js-ajax-form margin-top-20" action="{:cmf_plugin_url('LyzKefuChat://AdminIndex/index')}">
            <div class="form-group">
                <label class="col-sm-3 control-label">内部通讯服务注册地址</label>
                <div class="col-md-6 col-sm-10">
                    <input type="text" class="form-control" name="option[register]" value="{$option['register']||default=''}" placeholder="text://0.0.0.0:1236">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">注册地址</label>
                <div class="col-md-6 col-sm-10">
                    <input type="text" class="form-control" name="option[register_ip]" value="{$option['register_ip']||default=''}" placeholder="127.0.0.1:1236">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">分布式内网ip</label>
                <div class="col-md-6 col-sm-10">
                    <input type="text" class="form-control" name="option[inner_ip]" value="{$option['inner_ip']||default=''}" placeholder="127.0.0.1 分布式部署时请设置成内网ip（非127.0.0.1）">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">gateway地址</label>
                <div class="col-md-6 col-sm-10">
                    <input type="text" class="form-control" name="option[gateway]" value="{$option['gateway']||default=''}" placeholder="Websocket://0.0.0.0:7272  有几种协议，可以去workman去看看">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">gateway进程名称</label>
                <div class="col-md-6 col-sm-10">
                    <input type="text" class="form-control" name="option[gateway_processes_name]" value="{$option['gateway_processes_name']||default=''}" placeholder="ChatGateway  这个为了方便查看进程状态,自行设置">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">gateway进程数目</label>
                <div class="col-md-6 col-sm-10">
                    <input type="text" class="form-control" name="option[gateway_processes_num]" value="{$option['gateway_processes_num']||default=''}" placeholder="设置进程数，gateway进程数建议与cpu核数相同">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">gateway内部起始端口</label>
                <div class="col-md-6 col-sm-10">
                    <input type="text" class="form-control" name="option[gateway_start_port]" value="{$option['gateway_start_port']||default=''}" placeholder="如果内部起始端口为4000，开始4个进程，则4000 4001 4002 4003 4个端口作为内部通讯端口">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">gateway心跳数据</label>
                <div class="col-md-6 col-sm-10">
                    <input type="text" class="form-control" name="option[pingdata]" value="{$option['pingdata']||default=''}" placeholder='建议设置为{"type":"ping"}'>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">gateway心跳间隔</label>
                <div class="col-md-6 col-sm-10">
                    <input type="text" class="form-control" name="option[pingInterval]" value="{$option['pingInterval']||default=''}" placeholder="间隔建议设置为10">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">BusinessWorker进程名称</label>
                <div class="col-md-6 col-sm-10">
                    <input type="text" class="form-control" name="option[worker_processes_name]" value="{$option['worker_processes_name']||default=''}" placeholder="BusinessWorker进程名称">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">BusinessWorker进程数目</label>
                <div class="col-md-6 col-sm-10">
                    <input type="text" class="form-control" name="option[worker_processes_num]" value="{$option['worker_processes_num']||default=''}" placeholder="bussinessWorker进程数量">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">WebSocket地址</label>
                <div class="col-md-6 col-sm-10">
                    <input type="text" class="form-control" name="option[websocket_processes_name]" value="{$option['websocket_processes_name']||default=''}" placeholder="ws://0.0.0.0:7272">
                </div>
            </div>
            <input type="hidden" name="id" value="{$list.id}">
            <div class="form-group">
                <div class="col-sm-offset-4 col-sm-10">
                    <input type="reset" value="取消" class="btn btn-default">
                    <a class="btn btn-primary" onclick="recover();">恢复默认</a>
                    <button type="submit" class="btn btn-primary js-ajax-submit">保存</button>
                </div>
            </div>
        </form>
    </div>
</div>
<include file="public/scripts"/>
<script>
    function recover()
    {
        var id = $("input[name=id]").attr('value');
        $.post("{:cmf_plugin_url('LyzKefuChat://AdminIndex/recover')}",{id:id},function(data){
            if(data){
                layer.msg('恢复默认成功',{time: 2000}, function(){
                    location.reload();
                });
            }else {
                layer.msg('恢复默认失败', {time: 2000}, function () {
                    location.reload();
                });
            }
        });
    }
</script>
</body>
</html>